//
//  RequestManager.h
//  TalkBar
//
//  Created by xiaoling on 2018/3/5.
//  Copyright © 2018年 LSJ. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <AFNetworking/AFNetworking.h>


typedef void (^NetworkSuccessBlock)(id data,NSURLSessionDataTask * task);
typedef void (^NetworkFailureBlock)(NSError *error,NSURLSessionTask * task);

typedef enum  {
    GET = 0,
    POST,
} HttpMethod;

@interface MantisRequestManager : NSObject

@property(nonatomic,strong)AFHTTPSessionManager * httpManager;

+ (instancetype)shareManager;




//最原始数据请求(如请求qq 微信等vender)
+ (void)pureRequestWithUrl:(NSString *)baseUrl
                    method:(HttpMethod)method
                    params:(NSMutableDictionary*)mutabParams
               headerField:(id)headerField
                  progress:(void(^)(NSProgress *))progressBlock
                 onSuccess:(NetworkSuccessBlock)successBlock
                 onFailure:(NetworkFailureBlock)failureBlock;

/**
 网络请求  已经添加本app所需要的默认参数
 @param apiPath 接口名
 @param method GET POST
 @param params 请求参数
 @param headerField requestHeader
 @param progressBlock 进度
 @param successBlock 请求成功
 @param failureBlock 请求失败
 */
+ (void)requestDataAPI:(NSString *)apiPath
               baseUrl:(NSString *)baseUrl
                method:(HttpMethod)method
                params:(NSMutableDictionary *)params
           headerField:(id)headerField
              progress:(void(^)(NSProgress *))progressBlock
             onSuccess:(NetworkSuccessBlock)successBlock
             onFailure:(NetworkFailureBlock)failureBlock;

//默认服务器地址的数据请求(默认地址)
+ (void)requestDataAPI:(NSString *)apiPath
                method:(HttpMethod)method
                params:(NSMutableDictionary *)params
             onSuccess:(NetworkSuccessBlock)successBlock
             onFailure:(NetworkFailureBlock)failureBlock;

//自定义服务器地址的数据请求（可自定义服务器地址）
+ (void)requestDataBaseUrl:(NSString *)baseUrl
                       API:(NSString *)apiPath
                    method:(HttpMethod)method
                    params:(NSMutableDictionary *)params
                 onSuccess:(NetworkSuccessBlock)successBlock
                 onFailure:(NetworkFailureBlock)failureBlock;



@end
